home *** CD-ROM | disk | FTP | other *** search
/ Giga Games 1 / Giga Games.iso / net / usenet / volume11 / reve / patch1d < prev    next >
Encoding:
Internet Message Format  |  1990-12-11  |  32.6 KB

  1. Path: uunet!ogicse!zephyr.ens.tek.com!tekred!saab!billr
  2. From: billr@saab.CNA.TEK.COM (Bill Randle)
  3. Newsgroups: comp.sources.games
  4. Subject: v11i064:  reve - an othello game, Patch1d
  5. Message-ID: <6568@tekred.CNA.TEK.COM>
  6. Date: 16 Nov 90 18:56:03 GMT
  7. Sender: news@tekred.CNA.TEK.COM
  8. Lines: 1024
  9. Approved: billr@saab.CNA.TEK.COM
  10. Posted: Fri Nov 16 10:56:03 1990
  11.  
  12. Submitted-by: Rich Burridge <rburridge@sun.COM>
  13. Posting-number: Volume 11, Issue 64
  14. Archive-name: reve/Patch1d
  15. Patch-To: reve: Volume 11, Issue 52-58
  16. Environment: SunView, XView, X11R4, termcap
  17.  
  18.  
  19.  
  20. #! /bin/sh
  21. # This is a shell archive.  Remove anything before this line, then unpack
  22. # it by saving it into a file and typing "sh file".  To overwrite existing
  23. # files, type "sh file -c".  You can also feed this as standard input via
  24. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  25. # will see the following message at the end:
  26. #        "End of archive 4 (of 4)."
  27. # Contents:  patches01d
  28. # Wrapped by billr@saab on Fri Nov 16 10:46:45 1990
  29. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  30. if test -f 'patches01d' -a "${1}" != "-c" ; then 
  31.   echo shar: Will not clobber existing file \"'patches01d'\"
  32. else
  33. echo shar: Extracting \"'patches01d'\" \(30587 characters\)
  34. sed "s/^X//" >'patches01d' <<'END_OF_FILE'
  35. X
  36. X------- xview.c -------
  37. X*** /tmp/da28887    Fri Nov  9 10:38:30 1990
  38. X--- xview.c    Thu Nov  8 10:31:17 1990
  39. X***************
  40. X*** 7,17 ****
  41. X   *  Copyright (c) 1990 - Rich Burridge & Yves Gallot.
  42. X   *  All rights reserved.
  43. X   *
  44. X!  *  Permission is given to distribute these sources, as long as the
  45. X!  *  introductory messages are not removed, and no monies are exchanged.
  46. X   *
  47. X!  *  You are forbidden from using Reve as is, or in a modified state, in
  48. X!  *  any tournaments, without the permission of the authors.
  49. X   *
  50. X   *  No responsibility is taken for any errors or inaccuracies inherent
  51. X   *  either to the comments or the code of this program, but if reported
  52. X--- 7,22 ----
  53. X   *  Copyright (c) 1990 - Rich Burridge & Yves Gallot.
  54. X   *  All rights reserved.
  55. X   *
  56. X!  *  Permission is granted to copy this source, for redistribution
  57. X!  *  in source form only, provided the news headers in "substantially
  58. X!  *  unaltered format" are retained, the introductory messages are not
  59. X!  *  removed, and no monies are exchanged.
  60. X   *
  61. X!  *  Permission is also granted to copy this source, without the
  62. X!  *  news headers, for the purposes of making an executable copy by
  63. X!  *  means of compilation, provided that such copy will not be used
  64. X!  *  for the purposes of competition in any othello tournaments, without
  65. X!  *  prior permission from the authors.
  66. X   *
  67. X   *  No responsibility is taken for any errors or inaccuracies inherent
  68. X   *  either to the comments or the code of this program, but if reported
  69. X***************
  70. X*** 18,24 ****
  71. X   *  (see README file), then an attempt will be made to fix them.
  72. X   */
  73. X  
  74. X- #include <stdio.h>
  75. X  #include "reve.h"
  76. X  #include "color.h"
  77. X  #include "extern.h"
  78. X--- 23,28 ----
  79. X***************
  80. X*** 25,30 ****
  81. X--- 29,35 ----
  82. X  #include "images.h"
  83. X  #include <xview/xview.h>
  84. X  #include <xview/canvas.h>
  85. X+ #include <xview/panel.h>
  86. X  #include <xview/cms.h>
  87. X  #include <xview/cursor.h>
  88. X  #include <xview/svrimage.h>
  89. X***************
  90. X*** 33,57 ****
  91. X  
  92. X  enum gr_type gtype = GXVIEW ;      /* Graphics type. */
  93. X  
  94. X! #define  XV_SET       (void) xv_set
  95. X! #define  WINDOW_DONE  (void) window_done
  96. X  
  97. X! #define  BOLDFONT     "lucidasanstypewriter-bold-12"
  98. X! #define  DEFFONT      "fixed"
  99. X! #define  NORMALFONT   "lucidasanstypewriter-12"
  100. X  
  101. X! static void menu_proc() ;
  102. X  
  103. X! mpr_static(icon_pr,  64, 64, 1, icon_image) ;
  104. X! mpr_static(cicon_pr, 64, 64, 8, cicon_image) ;
  105. X  
  106. X  Canvas canvas ;
  107. X  Canvas_paint_window cpw ;
  108. X  Event *cur_event ;
  109. X! Frame frame ;
  110. X! Icon reve_icon ;
  111. X  Menu menus[MAXMENUS] ;
  112. X! Notify_value destroy() ;
  113. X  Server_image hglass_pr, nocur_pr ;
  114. X  Xv_Cursor cursor[MAXCURSORS] ;
  115. X  
  116. X--- 38,76 ----
  117. X  
  118. X  enum gr_type gtype = GXVIEW ;      /* Graphics type. */
  119. X  
  120. X! enum popup_pos {P_BELOW, P_RIGHT } ;   /* Positions relative to main frame. */
  121. X  
  122. X! #define  FRAME_BORDER_SIZE  7
  123. X! #define  FRAME_LABEL_SIZE   30
  124. X  
  125. X! #define  XV_CREATE          (void) xv_create
  126. X! #define  XV_SET             (void) xv_set
  127. X  
  128. X! #define  BOLDFONT           "lucidasanstypewriter-bold-12"
  129. X! #define  DEFFONT            "fixed"
  130. X! #define  NORMALFONT         "lucidasanstypewriter-12"
  131. X  
  132. X  Canvas canvas ;
  133. X  Canvas_paint_window cpw ;
  134. X  Event *cur_event ;
  135. X! Frame cframe ;                  /* Frame for Reve game board. */
  136. X! Frame frame ;                   /* Frame for control panel. */
  137. X! Frame ls_frame ;                /* Frame for load/save pop-up window. */
  138. X! Icon  creve_icon ;              /* Icon for game board. */
  139. X! Icon  reve_icon ;               /* Icon for control panel. */
  140. X! Panel panel ;                   /* Xview interface panel. */
  141. X! 
  142. X! Frame ls_frame ;                /* Frame for load/save pop-up window. */
  143. X! Panel ls_panel ;                /* Panel for load/save operations. */
  144. X! Panel_item ls_button ;          /* Button to start load/save operation. */
  145. X! Panel_item ls_text ;            /* Load/Save text filename item. */
  146. X! Panel_item mes_items[4] ;       /* Four generic message items. */
  147. X! Panel_setting start_load_save() ;
  148. X! Menu game_menu ;                /* Menu for 'New Game' button. */
  149. X  Menu menus[MAXMENUS] ;
  150. X! Notify_value quit_proc() ;
  151. X! Panel_item black_item ;
  152. X! Panel_item white_item ;
  153. X  Server_image hglass_pr, nocur_pr ;
  154. X  Xv_Cursor cursor[MAXCURSORS] ;
  155. X  
  156. X***************
  157. X*** 75,81 ****
  158. X--- 94,106 ----
  159. X  int opvals[3] ;         /* Pixrect rasterop values. */
  160. X  int started ;           /* Set just before window is displayed. */
  161. X  
  162. X+ void destroy_frame() ;
  163. X+ static void menu_proc(),  new_game_proc(), pop_props(),    set_depth() ;
  164. X+ static void set_player(), unimplemented(), xv_load_game(), xv_save_game() ;
  165. X  
  166. X+ extern int mnb ;        /* Number of current move */
  167. X+ 
  168. X+ 
  169. X  void
  170. X  batch(state)            /* Turn graphics batching on or off. */
  171. X  enum bltype state ;
  172. X***************
  173. X*** 155,161 ****
  174. X  void
  175. X  destroy_frame()        /* Destroy reve window. */
  176. X  {
  177. X!   WINDOW_DONE(frame) ;
  178. X  }
  179. X  
  180. X  
  181. X--- 180,188 ----
  182. X  void
  183. X  destroy_frame()        /* Destroy reve window. */
  184. X  {
  185. X!   xv_destroy_safe(frame) ;
  186. X!   xv_destroy_safe(cframe) ;
  187. X!   exit(0) ;
  188. X  }
  189. X  
  190. X  
  191. X***************
  192. X*** 170,176 ****
  193. X--- 197,223 ----
  194. X  }
  195. X  
  196. X  
  197. X+ /*ARGSUSED*/
  198. X  void
  199. X+ draw_button(item, color, image)      /* **DUMMY ROUTINE** */
  200. X+ enum panel_type item ;
  201. X+ int color ;
  202. X+ enum image_type image ;
  203. X+ {
  204. X+ }
  205. X+ 
  206. X+ 
  207. X+ /*ARGSUSED*/
  208. X+ void
  209. X+ draw_cycle(item, color, image)       /* **DUMMY ROUTINE** */
  210. X+ enum panel_type item ;
  211. X+ int color ;
  212. X+ enum image_type image ;
  213. X+ {
  214. X+ }
  215. X+ 
  216. X+ 
  217. X+ void
  218. X  draw_image(x, y, width, height, image)
  219. X  int x, y, width, height ;
  220. X  enum image_type image ;
  221. X***************
  222. X*** 193,199 ****
  223. X  
  224. X    d = (int) cur_dpyno ;
  225. X    if (iscolor[d]) gc_val.foreground = palette[color] ;
  226. X!   else            gc_val.foreground = foregnd ;
  227. X    gc_val.function = opvals[(int) op] ;
  228. X    XChangeGC(dpy, gc, GCForeground | GCFunction, &gc_val) ;
  229. X    XDrawLine(dpy, xid, gc, x1, y1, x2, y2) ;
  230. X--- 240,250 ----
  231. X  
  232. X    d = (int) cur_dpyno ;
  233. X    if (iscolor[d]) gc_val.foreground = palette[color] ;
  234. X!   else
  235. X!     { 
  236. X!       if (color == C_WHITE) gc_val.foreground = backgnd ;
  237. X!       else                  gc_val.foreground = foregnd ;
  238. X!     }
  239. X    gc_val.function = opvals[(int) op] ;
  240. X    XChangeGC(dpy, gc, GCForeground | GCFunction, &gc_val) ;
  241. X    XDrawLine(dpy, xid, gc, x1, y1, x2, y2) ;
  242. X***************
  243. X*** 248,253 ****
  244. X--- 299,336 ----
  245. X  }
  246. X  
  247. X  
  248. X+ void
  249. X+ draw_textfield()                      /* **DUMMY ROUTINE** */
  250. X+ {
  251. X+ }
  252. X+ 
  253. X+ 
  254. X+ static Notify_value
  255. X+ frame_event(frame, event, arg, type)
  256. X+ Frame frame ;
  257. X+ Event *event ;
  258. X+ Notify_arg arg ;
  259. X+ Notify_event_type type ;
  260. X+ {
  261. X+   int action ;
  262. X+ 
  263. X+   action = event_action(event) ;
  264. X+   if (action == ACTION_CLOSE) XV_SET(cframe, XV_SHOW, FALSE, 0) ;
  265. X+   if (action == WIN_RESIZE)
  266. X+     {
  267. X+       position_popup(frame, cframe, P_BELOW) ;
  268. X+       XV_SET(cframe, XV_SHOW, TRUE, 0) ;
  269. X+     }
  270. X+   return(notify_next_event_func(frame, event, arg, type)) ;
  271. X+ }
  272. X+ 
  273. X+ 
  274. X+ void
  275. X+ get_filename()            /* **DUMMY ROUTINE** */
  276. X+ {
  277. X+ }
  278. X+ 
  279. X+ 
  280. X  XFontStruct *
  281. X  get_font(name)
  282. X  char *name ;
  283. X***************
  284. X*** 286,291 ****
  285. X--- 369,375 ----
  286. X  
  287. X  init_ws_type()
  288. X  {
  289. X+   show_notes = TRUE ;   /* Override generic value for XView version. */
  290. X    move_delta = 10 ;
  291. X    cur_dpyno = DPY1 ;
  292. X    started = 0 ;       /* Kludge to correctly handle repaints. */
  293. X***************
  294. X*** 331,339 ****
  295. X  void
  296. X  make_canvas()               /* Create canvas for game board. */
  297. X  {
  298. X!   canvas = xv_create(frame,               CANVAS,
  299. X                       CANVAS_RETAINED,     FALSE,
  300. X!                      OPENWIN_AUTO_CLEAR,  FALSE,
  301. X                       XV_HEIGHT,           TOTAL_HEIGHT,
  302. X                       XV_WIDTH,            TOTAL_WIDTH,
  303. X                       CANVAS_PAINTWINDOW_ATTRS,
  304. X--- 415,431 ----
  305. X  void
  306. X  make_canvas()               /* Create canvas for game board. */
  307. X  {
  308. X!   cframe = xv_create(XV_NULL,                  FRAME,
  309. X!                      XV_SHOW,                  FALSE,
  310. X!                      FRAME_ICON,               creve_icon,
  311. X!                      FRAME_NO_CONFIRM,         TRUE,
  312. X!                      WIN_ERROR_MSG,            "Reve: Can't create window.",
  313. X!                      FRAME_SHOW_RESIZE_CORNER, FALSE,
  314. X!                      FRAME_SHOW_HEADER,        FALSE,
  315. X!                      0) ;
  316. X!   canvas = xv_create(cframe,              CANVAS,
  317. X                       CANVAS_RETAINED,     FALSE,
  318. X!                      OPENWIN_AUTO_CLEAR,  FALSE, 
  319. X                       XV_HEIGHT,           TOTAL_HEIGHT,
  320. X                       XV_WIDTH,            TOTAL_WIDTH,
  321. X                       CANVAS_PAINTWINDOW_ATTRS,
  322. X***************
  323. X*** 348,358 ****
  324. X                         WIN_EVENT_PROC,    canvas_proc,
  325. X                         0,
  326. X                       0) ;
  327. X    cpw = canvas_paint_window(canvas) ;
  328. X!   cursor[(int) CANVASCUR] = xv_get(cpw, WIN_CURSOR) ;
  329. X  
  330. X!   dpy = (Display *) xv_get(frame, XV_DISPLAY) ;
  331. X!   xid = (Drawable) xv_get(cpw, XV_XID) ;
  332. X  
  333. X    screen = DefaultScreen(dpy) ;
  334. X    root = RootWindow(dpy, screen) ;
  335. X--- 440,453 ----
  336. X                         WIN_EVENT_PROC,    canvas_proc,
  337. X                         0,
  338. X                       0) ;
  339. X+   window_fit(cframe) ;
  340. X+   notify_interpose_destroy_func(cframe, quit_proc) ;
  341. X+ 
  342. X    cpw = canvas_paint_window(canvas) ;
  343. X!   cursor[(int) CANVASCUR] = xv_get(cpw, WIN_CURSOR, NULL) ;
  344. X  
  345. X!   dpy = (Display *) xv_get(frame, XV_DISPLAY, NULL) ;
  346. X!   xid = (Drawable) xv_get(cpw, XV_XID, NULL) ;
  347. X  
  348. X    screen = DefaultScreen(dpy) ;
  349. X    root = RootWindow(dpy, screen) ;
  350. X***************
  351. X*** 387,415 ****
  352. X    cursor[(int) NOCURSOR] = xv_create(XV_NULL,      CURSOR,
  353. X                                       CURSOR_IMAGE, nocur_pr,
  354. X                                       0) ;
  355. X!   load_colors() ;
  356. X  
  357. X-   images[(int) BUT_STENCIL] = make_server_image(button_stencil_image) ;
  358. X-   images[(int) BUT_INVERT]  = make_server_image(button_invert_image) ;
  359. X-   images[(int) BUT_NORMAL]  = make_server_image(button_normal_image) ;
  360. X-   images[(int) CY_NORMAL]   = make_server_image(cycle_glyph_image) ;
  361. X-   images[(int) CY_STENCIL]  = make_server_image(cycle_stencil_image) ;
  362. X-   images[(int) CY_LINVERT]  = make_server_image(cycle_linvert_image) ;
  363. X-   images[(int) CY_RINVERT]  = make_server_image(cycle_rinvert_image) ;
  364. X    images[(int) P_WHITE]     = make_server_image(white_image) ;
  365. X    images[(int) P_BLACK]     = make_server_image(black_image) ;
  366. X  }
  367. X  
  368. X  
  369. X! void
  370. X! make_frame(argc, argv)      /* Create reve window. */
  371. X  int argc ;
  372. X  char *argv[] ;
  373. X  {
  374. X    opvals[(int) RCLR] = GXclear ;
  375. X    opvals[(int) RSRC] = GXcopy ;
  376. X    opvals[(int) RINV] = GXxor ;
  377. X  
  378. X    xv_init(XV_INIT_ARGS, argc, argv, 0) ;
  379. X    frame = xv_create(XV_NULL,                  FRAME,
  380. X                      FRAME_ICON,               reve_icon,
  381. X--- 482,507 ----
  382. X    cursor[(int) NOCURSOR] = xv_create(XV_NULL,      CURSOR,
  383. X                                       CURSOR_IMAGE, nocur_pr,
  384. X                                       0) ;
  385. X!   if (!monochrome) load_colors() ;
  386. X  
  387. X    images[(int) P_WHITE]     = make_server_image(white_image) ;
  388. X    images[(int) P_BLACK]     = make_server_image(black_image) ;
  389. X  }
  390. X  
  391. X  
  392. X! void 
  393. X! make_frame(argc, argv)     /* Create frame and the panel, buttons, menus. */
  394. X  int argc ;
  395. X  char *argv[] ;
  396. X  {
  397. X+   Menu_item item ;
  398. X+ 
  399. X    opvals[(int) RCLR] = GXclear ;
  400. X    opvals[(int) RSRC] = GXcopy ;
  401. X    opvals[(int) RINV] = GXxor ;
  402. X  
  403. X+ /* Create the frame and the control panel */
  404. X+ 
  405. X    xv_init(XV_INIT_ARGS, argc, argv, 0) ;
  406. X    frame = xv_create(XV_NULL,                  FRAME,
  407. X                      FRAME_ICON,               reve_icon,
  408. X***************
  409. X*** 416,423 ****
  410. X                      FRAME_LABEL,              line,
  411. X                      FRAME_NO_CONFIRM,         TRUE,
  412. X                      FRAME_SHOW_RESIZE_CORNER, FALSE,
  413. X!                     WIN_ERROR_MSG,            "Can't create window.",
  414. X!                     0) ;
  415. X    iscolor[(int) cur_dpyno] = ((int) xv_get(frame, WIN_DEPTH) > 1) ? 1 : 0 ;
  416. X  }
  417. X  
  418. X--- 508,693 ----
  419. X                      FRAME_LABEL,              line,
  420. X                      FRAME_NO_CONFIRM,         TRUE,
  421. X                      FRAME_SHOW_RESIZE_CORNER, FALSE,
  422. X!                     WIN_ERROR_MSG,            "Reve: Can't create window.",
  423. X!                     NULL) ;
  424. X! 
  425. X!   panel = (Panel) xv_create(frame, PANEL, 0) ;
  426. X! 
  427. X! /* Menu for the 'new game' button */
  428. X! 
  429. X!   game_menu = (Menu) xv_create(XV_NULL, MENU,
  430. X!                                MENU_NOTIFY_PROC, new_game_proc,
  431. X!                                MENU_STRINGS,
  432. X!                                  "Human (black)    vs. Computer (white)",
  433. X!                                  "Computer (black) vs. Human (white)",
  434. X!                                  "Human (black)    vs. Human (white)",
  435. X!                                  0,
  436. X!                                0) ;
  437. X! 
  438. X! /* Create the buttons and other controls. */
  439. X! 
  440. X!   XV_CREATE(panel,              PANEL_BUTTON,
  441. X!             PANEL_ITEM_X,       xv_col(panel, 0),
  442. X!             PANEL_ITEM_Y,       xv_row(panel, 0),
  443. X!             PANEL_LABEL_STRING, "New Game",
  444. X!             PANEL_ITEM_MENU,    game_menu,
  445. X!             0) ;
  446. X! 
  447. X!   XV_CREATE(panel,              PANEL_BUTTON,
  448. X!             PANEL_ITEM_X,       xv_col(panel, 15),
  449. X!             PANEL_ITEM_Y,       xv_row(panel, 0),
  450. X!             PANEL_LABEL_STRING, "Load Game...",
  451. X!             PANEL_NOTIFY_PROC,  xv_load_game,
  452. X!             0) ;
  453. X! 
  454. X!   XV_CREATE(panel,              PANEL_BUTTON,
  455. X!             PANEL_ITEM_X,       xv_col(panel, 30),
  456. X!             PANEL_ITEM_Y,       xv_row(panel, 0),
  457. X!             PANEL_LABEL_STRING, "Save Game...",
  458. X!             PANEL_NOTIFY_PROC,  xv_save_game,
  459. X!             0) ;
  460. X! 
  461. X!   XV_CREATE(panel,              PANEL_BUTTON,
  462. X!             PANEL_ITEM_X,       xv_col(panel, 45),
  463. X!             PANEL_ITEM_Y,       xv_row(panel, 0),
  464. X!             PANEL_LABEL_STRING, "     Help      ",
  465. X!             PANEL_NOTIFY_PROC,  unimplemented,
  466. X!             0) ;
  467. X!  
  468. X!   XV_CREATE(panel,              PANEL_BUTTON,
  469. X!             PANEL_ITEM_X,       xv_col(panel, 0),
  470. X!             PANEL_ITEM_Y,       xv_row(panel, 1),
  471. X!             PANEL_LABEL_STRING, "   Moves?   ",
  472. X!             PANEL_NOTIFY_PROC,  show_all_moves,
  473. X!             0) ;
  474. X! 
  475. X!   XV_CREATE(panel,              PANEL_BUTTON,
  476. X!             PANEL_ITEM_X,       xv_col(panel, 15),
  477. X!             PANEL_ITEM_Y,       xv_row(panel, 1),
  478. X!             PANEL_LABEL_STRING, "   Suggest  ",
  479. X!             PANEL_NOTIFY_PROC,  suggest,
  480. X!             0) ;        
  481. X! 
  482. X!   XV_CREATE(panel,              PANEL_BUTTON,
  483. X!             PANEL_ITEM_X,       xv_col(panel, 30),
  484. X!             PANEL_ITEM_Y,       xv_row(panel, 1),
  485. X!             PANEL_LABEL_STRING, "     Undo     ",
  486. X!             PANEL_NOTIFY_PROC,  undo,
  487. X!             0) ;        
  488. X! 
  489. X!   XV_CREATE(panel,              PANEL_BUTTON,
  490. X!             PANEL_ITEM_X,       xv_col(panel, 45),
  491. X!             PANEL_ITEM_Y,       xv_row(panel, 1),
  492. X!             PANEL_LABEL_STRING, "     Quit     ",
  493. X!             PANEL_NOTIFY_PROC,  destroy_frame,
  494. X!             0) ;
  495. X! 
  496. X!   XV_CREATE(panel,              PANEL_CHECK_BOX,
  497. X!             PANEL_ITEM_X,       xv_col(panel, 0),
  498. X!             PANEL_ITEM_Y,       xv_row(panel, 4),
  499. X!             PANEL_LABEL_STRING, "Show Info  ",
  500. X!             PANEL_NOTIFY_PROC,  pop_props,
  501. X!             PANEL_VALUE,        1,
  502. X!             0) ;
  503. X! 
  504. X!   black_item = xv_create(panel,                PANEL_CHOICE_STACK,
  505. X!                          PANEL_ITEM_X,         xv_col(panel, 0),
  506. X!                          PANEL_ITEM_Y,         xv_row(panel, 2),
  507. X!                          PANEL_LABEL_STRING,   "Black:",
  508. X!                          PANEL_CHOICE_STRINGS,
  509. X!                            "human",
  510. X!                            "computer",
  511. X!                            0,
  512. X!                          PANEL_NOTIFY_PROC,    set_player,
  513. X!                          PANEL_VALUE,          items[(int) BLACK_PLAYS].value,
  514. X!                          0) ;
  515. X! 
  516. X!   white_item = xv_create(panel,                PANEL_CHOICE_STACK,
  517. X!                          PANEL_ITEM_X,         xv_col(panel, 0),
  518. X!                          PANEL_ITEM_Y,         xv_row(panel, 3),
  519. X!                          PANEL_LABEL_STRING,   "White:",
  520. X!                          PANEL_CHOICE_STRINGS,
  521. X!                            "human",
  522. X!                            "computer",
  523. X!                            0,
  524. X!                          PANEL_NOTIFY_PROC,    set_player,
  525. X!                          PANEL_VALUE,          items[(int) WHITE_PLAYS].value,
  526. X!                          0) ;
  527. X! 
  528. X!   mes_items[(int) (TURN_MES - PANEL_MES)] = xv_create(panel, PANEL_MESSAGE,
  529. X!                        PANEL_ITEM_X,       xv_col(panel, 30),
  530. X!                        PANEL_ITEM_Y,       xv_row(panel, 2),
  531. X!                        PANEL_LABEL_STRING, "Black to move",
  532. X!                        0) ;
  533. X!  
  534. X!   mes_items[(int) (SCORE_MES - PANEL_MES)] = xv_create(panel, PANEL_MESSAGE,
  535. X!                        PANEL_ITEM_X,       xv_col(panel, 30),
  536. X!                        PANEL_ITEM_Y,       xv_row(panel, 3),
  537. X!                        PANEL_LABEL_STRING, "",
  538. X!                        0) ;
  539. X!  
  540. X!   mes_items[(int) (EVAL_MES - PANEL_MES)] = xv_create(panel, PANEL_MESSAGE,
  541. X!                        PANEL_ITEM_X,       xv_col(panel, 30),
  542. X!                        PANEL_ITEM_Y,       xv_row(panel, 4),
  543. X!                        PANEL_LABEL_STRING, "",
  544. X!                        0) ;
  545. X!  
  546. X!  
  547. X!   mes_items[(int) (PANEL_MES - PANEL_MES)] = xv_create(panel, PANEL_MESSAGE,
  548. X!                        PANEL_ITEM_X,       xv_col(panel, 30),
  549. X!                        PANEL_ITEM_Y,       xv_row(panel, 5),
  550. X!                        PANEL_LABEL_STRING, "",
  551. X!                        0) ;
  552. X!  
  553. X!   XV_CREATE(panel,                PANEL_CHOICE_STACK,
  554. X!             PANEL_ITEM_X,         xv_col(panel, 0),
  555. X!             PANEL_ITEM_Y,         xv_row(panel, 5),
  556. X!             PANEL_LABEL_STRING,   "Difficulty: ",
  557. X!             PANEL_CHOICE_STRINGS,
  558. X!               " Instant",
  559. X!               " 1 Minute",
  560. X!               " 3 Minutes",
  561. X!               " 5 Minutes",
  562. X!               "10 Minutes",
  563. X!               "15 Minutes",
  564. X!               "20 Minutes",
  565. X!               "Tournament (30)",
  566. X!               "60 MInutes",
  567. X!               0,
  568. X!             PANEL_NOTIFY_PROC,     set_depth,
  569. X!             PANEL_VALUE,           0,
  570. X!             0) ;
  571. X! 
  572. X!   window_fit(panel) ;
  573. X!   window_fit(frame) ;
  574. X!   notify_interpose_event_func(frame, frame_event, NOTIFY_SAFE) ;
  575. X!   notify_interpose_destroy_func(frame, quit_proc) ;
  576. X! 
  577. X!   ls_frame = xv_create(frame,                FRAME_CMD,
  578. X!                        FRAME_LABEL,          "Name your Game ...",
  579. X!                        FRAME_CMD_PUSHPIN_IN, TRUE,
  580. X!                        0) ;
  581. X!    
  582. X!   ls_panel = (Panel) xv_get(ls_frame, FRAME_CMD_PANEL) ;
  583. X! 
  584. X!   ls_text = XV_CREATE(ls_panel,                   PANEL_TEXT,
  585. X!                       PANEL_ITEM_X,               xv_col(ls_panel, 0),
  586. X!                       PANEL_ITEM_Y,               xv_row(ls_panel, 0),
  587. X!                       PANEL_LABEL_STRING,         "Load File: ",
  588. X!                       PANEL_VALUE,                gamefile,
  589. X!                       PANEL_VALUE_DISPLAY_LENGTH, 30,
  590. X!                       PANEL_VALUE_STORED_LENGTH,  255,
  591. X!                       0) ; 
  592. X! 
  593. X!   ls_button = xv_create(ls_panel,         PANEL_BUTTON,
  594. X!                         PANEL_LABEL_STRING, "Load",
  595. X!                         PANEL_NOTIFY_PROC,  start_load_save,
  596. X!                         XV_X,               xv_col(ls_panel, 18),
  597. X!                         XV_Y,               xv_row(ls_panel, 1),
  598. X!                         0) ;
  599. X!   window_fit(ls_panel) ;
  600. X!   window_fit(ls_frame) ;
  601. X! 
  602. X    iscolor[(int) cur_dpyno] = ((int) xv_get(frame, WIN_DEPTH) > 1) ? 1 : 0 ;
  603. X  }
  604. X  
  605. X***************
  606. X*** 425,436 ****
  607. X  void
  608. X  make_icon()
  609. X  {
  610. X    reve_icon = xv_create(XV_NULL,    ICON,
  611. X!                         ICON_IMAGE, &icon_pr,
  612. X                          0) ;
  613. X  }
  614. X  
  615. X  
  616. X  Drawable
  617. X  make_server_image(image)
  618. X  unsigned short image[] ;
  619. X--- 695,727 ----
  620. X  void
  621. X  make_icon()
  622. X  {
  623. X+ 
  624. X+ /* XXX: Need to correctly handle color icons on a color screen. */
  625. X+ 
  626. X+   Server_image icon_sv ;
  627. X+ 
  628. X+   icon_sv = xv_create(XV_NULL, SERVER_IMAGE,
  629. X+                       SERVER_IMAGE_BITS,  icon_image,
  630. X+                       SERVER_IMAGE_DEPTH, 1,
  631. X+                       XV_WIDTH,           64,
  632. X+                       XV_HEIGHT,          64,
  633. X+                       0) ;
  634. X+ 
  635. X    reve_icon = xv_create(XV_NULL,    ICON,
  636. X!                         ICON_IMAGE, icon_sv,
  637. X                          0) ;
  638. X+   creve_icon = xv_create(XV_NULL,    ICON,
  639. X+                          ICON_IMAGE, icon_sv,
  640. X+                          0) ;
  641. X  }
  642. X  
  643. X  
  644. X+ void
  645. X+ make_panel()                   /* **DUMMY ROUTINE** */
  646. X+ {
  647. X+ }
  648. X+ 
  649. X+ 
  650. X  Drawable
  651. X  make_server_image(image)
  652. X  unsigned short image[] ;
  653. X***************
  654. X*** 442,448 ****
  655. X                     XV_HEIGHT,         64,
  656. X                     SERVER_IMAGE_BITS, image,
  657. X                     0) ;
  658. X!   return((int) xv_get(temp, XV_XID)) ;
  659. X  }
  660. X  
  661. X  
  662. X--- 733,739 ----
  663. X                     XV_HEIGHT,         64,
  664. X                     SERVER_IMAGE_BITS, image,
  665. X                     0) ;
  666. X!   return((int) xv_get(temp, XV_XID, NULL)) ;
  667. X  }
  668. X  
  669. X  
  670. X***************
  671. X*** 459,464 ****
  672. X--- 750,840 ----
  673. X  
  674. X  
  675. X  void
  676. X+ message(mtype, str)
  677. X+ enum panel_type mtype ;
  678. X+ char *str ;
  679. X+ {
  680. X+   XV_SET(mes_items[(int) (mtype - PANEL_MES)], PANEL_LABEL_STRING, str, 0) ;
  681. X+ }
  682. X+ 
  683. X+ 
  684. X+ static void
  685. X+ new_game_proc(menu, menu_item)
  686. X+ Menu menu ;
  687. X+ Menu_item menu_item ;
  688. X+ {
  689. X+   switch((int) xv_get(menu_item, MENU_VALUE))
  690. X+     {
  691. X+       case 1 : items[(int) BLACK_PLAYS].value = HUMAN ;
  692. X+                items[(int) WHITE_PLAYS].value = COMPUTER ;
  693. X+                cmode = WHITE_START ;
  694. X+                dtype = XBLACK ;
  695. X+                break ;
  696. X+ 
  697. X+       case 2 : items[(int) BLACK_PLAYS].value = COMPUTER ;
  698. X+                items[(int) WHITE_PLAYS].value = HUMAN ;
  699. X+                cmode = BLACK_START ;
  700. X+                dtype = XWHITE ;
  701. X+                break ;
  702. X+ 
  703. X+       case 3 : items[(int) BLACK_PLAYS].value = HUMAN ;
  704. X+                items[(int) WHITE_PLAYS].value = HUMAN ;
  705. X+                cmode = BLACK_START ;
  706. X+                dtype = XBOTH ;
  707. X+     }
  708. X+   XV_SET(black_item, PANEL_VALUE, items[(int) BLACK_PLAYS].value) ;
  709. X+   XV_SET(white_item, PANEL_VALUE, items[(int) WHITE_PLAYS].value) ;
  710. X+   new_game() ;
  711. X+ }
  712. X+ 
  713. X+ 
  714. X+ /* Callback for the check box to show/hide evaluation and score. */
  715. X+ 
  716. X+ static void
  717. X+ pop_props(item, value, event)
  718. X+ {
  719. X+   show_notes = !show_notes ;
  720. X+   if (!show_notes)
  721. X+     {
  722. X+       XV_SET(mes_items[(int) (EVAL_MES - PANEL_MES)],
  723. X+              PANEL_LABEL_STRING, "",
  724. X+              0) ;
  725. X+       XV_SET(mes_items[(int) (SCORE_MES - PANEL_MES)],
  726. X+              PANEL_LABEL_STRING, "",
  727. X+              0) ;
  728. X+     }
  729. X+ }
  730. X+ 
  731. X+ 
  732. X+ void
  733. X+ position_popup(parent, child, position)
  734. X+ Frame parent, child ;
  735. X+ int position ;
  736. X+ {
  737. X+   Rect crect, prect ;
  738. X+   int height, width ;
  739. X+ 
  740. X+   if (((int) xv_get(child, XV_SHOW)) && position == P_RIGHT) return ;
  741. X+   frame_get_rect(parent, &prect) ;
  742. X+   frame_get_rect(child,  &crect) ;
  743. X+   height = (int) xv_get(parent, XV_HEIGHT) ;
  744. X+   width  = (int) xv_get(parent, XV_WIDTH) ;
  745. X+ 
  746. X+   switch (position)
  747. X+     {
  748. X+       case P_BELOW : crect.r_left = prect.r_left + FRAME_BORDER_SIZE ;
  749. X+                      crect.r_top  = prect.r_top + height + FRAME_LABEL_SIZE +
  750. X+                                     FRAME_BORDER_SIZE ;
  751. X+                      break ;
  752. X+       case P_RIGHT : crect.r_left = prect.r_left + width +
  753. X+                                                    (2 * FRAME_BORDER_SIZE) ;
  754. X+                      crect.r_top  = prect.r_top ;
  755. X+     }
  756. X+   frame_set_rect(child, &crect) ;
  757. X+ }
  758. X+ 
  759. X+ 
  760. X+ void
  761. X  process_event()       /* Process the next canvas event. */
  762. X  {
  763. X    int id ;
  764. X***************
  765. X*** 493,499 ****
  766. X--- 869,896 ----
  767. X  }
  768. X  
  769. X  
  770. X+ static Notify_value
  771. X+ quit_proc(frame, status)
  772. X+ Frame frame ;
  773. X+ Destroy_status status ;
  774. X+ {
  775. X+   if (status == DESTROY_PROCESS_DEATH || status == DESTROY_CLEANUP)
  776. X+     {
  777. X+       xv_destroy_safe(frame) ;
  778. X+       xv_destroy_safe(cframe) ;
  779. X+       exit(0) ;
  780. X+     }
  781. X+   return(notify_next_destroy_func(frame, status)) ;
  782. X+ }
  783. X+ 
  784. X+ 
  785. X  void
  786. X+ remove_textfield()         /* **DUMMY ROUTINE** */
  787. X+ {
  788. X+ }
  789. X+ 
  790. X+ 
  791. X+ void
  792. X  set_cursor(ctype)
  793. X  enum curtype ctype ;
  794. X  {
  795. X***************
  796. X*** 505,522 ****
  797. X  
  798. X  /*ARGSUSED*/
  799. X  void
  800. X! start_tool(dtype)      /* Display window and start the notifier. */
  801. X! enum disp_type dtype ;
  802. X  {
  803. X!   if (iscolor[(int) cur_dpyno])
  804. X      {
  805. X!       reve_icon = (Icon) xv_get(frame, FRAME_ICON) ;
  806. X!       XV_SET(reve_icon,
  807. X!              ICON_IMAGE, &cicon_pr,
  808. X!              0) ;
  809. X!       XV_SET(frame, FRAME_ICON, reve_icon, 0) ;
  810. X      }
  811. X!   window_fit(frame) ;
  812. X    started = 1 ;
  813. X    xv_main_loop(frame) ;
  814. X  }
  815. X--- 902,1025 ----
  816. X  
  817. X  /*ARGSUSED*/
  818. X  void
  819. X! set_cycle(mtype, str)                    /* **DUMMY ROUTINE** */
  820. X! enum panel_type mtype ;
  821. X! char *str ;
  822. X  {
  823. X! }
  824. X! 
  825. X! 
  826. X! static void 
  827. X! set_depth(item, value, event)   /* Callback to set the level of difficulty */
  828. X! Panel_item item ;
  829. X! int value ;
  830. X! Event *event ;
  831. X! {
  832. X!   level = value + 1 ;
  833. X!   items[(int) DIFFICULTY].value = level - 1 ;
  834. X! }
  835. X! 
  836. X! 
  837. X! static void
  838. X! set_player(item, value, event)   /* Callback to set black/white player. */
  839. X! Panel_item item ;
  840. X! int value ;
  841. X! Event *event ;
  842. X! {
  843. X!   char *label ;
  844. X!   enum panel_type this, other ;
  845. X!   int curi, curo ;
  846. X! 
  847. X!   label = (char *) xv_get(item, PANEL_LABEL_STRING) ;
  848. X!   if (EQUAL(label, "Black"))
  849. X      {
  850. X!       this = BLACK_PLAYS ;
  851. X!       other = WHITE_PLAYS ;
  852. X      }
  853. X!   else
  854. X!     {
  855. X!       this = WHITE_PLAYS ;
  856. X!       other = BLACK_PLAYS ;
  857. X!     }
  858. X! 
  859. X!   curi = items[(int) this].value = value ;
  860. X!   curo = items[(int) other].value ;
  861. X! 
  862. X!   if (curi == COMPUTER && curo == COMPUTER)
  863. X!     {
  864. X!       curi = HUMAN ;
  865. X!       XV_SET(item, PANEL_VALUE, curi, 0) ;
  866. X!       items[(int) this].value = curi ;
  867. X!       message(PANEL_MES, "Computer can't play both players.") ;
  868. X!     }
  869. X!   if (curi == HUMAN    && curo == COMPUTER)
  870. X!     dtype = (this == BLACK_PLAYS) ? XBLACK : XWHITE ;
  871. X!   else if (curi == COMPUTER && curo == HUMAN)
  872. X!     dtype = (this == BLACK_PLAYS) ? XWHITE : XBLACK ;
  873. X!   else if (curi == HUMAN    && curo == HUMAN)
  874. X!     dtype = (dtype == XTWO) ? XTWO : XBOTH ;
  875. X!  
  876. X!   if (curi == COMPUTER)
  877. X!     if ((this == BLACK_PLAYS && cmode == BLACK_START) ||
  878. X!         (this == WHITE_PLAYS && cmode == WHITE_START))
  879. X!       computer_move(next_player) ;
  880. X! }
  881. X! 
  882. X! 
  883. X! Panel_setting
  884. X! start_load_save(item, event)
  885. X! Panel_item item ;
  886. X! Event *event ;
  887. X! {
  888. X!   char *label ;
  889. X! 
  890. X!   XV_SET(ls_frame, XV_SHOW, FALSE, NULL) ;
  891. X!   STRCPY(gamefile, (char *) xv_get(ls_text, PANEL_VALUE)) ;
  892. X!   label = (char *) xv_get(ls_button, PANEL_LABEL_STRING) ;
  893. X!   if (EQUAL(label, "Load")) load_game() ;
  894. X!   else                      save_game() ;
  895. X!   return(PANEL_NONE) ;
  896. X! }
  897. X! 
  898. X! 
  899. X! /*ARGSUSED*/
  900. X! void
  901. X! start_tool(dtype)      /* Display window and start the notifier. */
  902. X! enum disp_type dtype ;
  903. X! {
  904. X    started = 1 ;
  905. X    xv_main_loop(frame) ;
  906. X+ }
  907. X+ 
  908. X+ 
  909. X+ static void         /* Dummy function for unimplemented callbacks */
  910. X+ unimplemented()
  911. X+ {
  912. X+   message(PANEL_MES, "Not implemented yet.\n") ;
  913. X+ }
  914. X+ 
  915. X+ 
  916. X+ static void 
  917. X+ xv_load_game(item, value, event)    /* Callback for loading a game button. */
  918. X+ Panel_item item ;
  919. X+ int value ;
  920. X+ Event *event ;
  921. X+ {
  922. X+   position_popup(frame, ls_frame, P_RIGHT) ;
  923. X+   XV_SET(ls_text, PANEL_LABEL_STRING, "Load File: ", 0) ;
  924. X+   XV_SET(ls_button, PANEL_LABEL_STRING, "Load", 0) ;
  925. X+   XV_SET(ls_frame, XV_SHOW, TRUE, NULL) ;
  926. X+ }
  927. X+ 
  928. X+ 
  929. X+ static void 
  930. X+ xv_save_game(item, value, event)    /* Callback load saving a game button. */
  931. X+ Panel_item item ;
  932. X+ int value ;
  933. X+ Event *event ;
  934. X+ {
  935. X+   position_popup(frame, ls_frame, P_RIGHT) ;
  936. X+   XV_SET(ls_text, PANEL_LABEL_STRING, "Save File: ", 0) ;
  937. X+   XV_SET(ls_button, PANEL_LABEL_STRING, "Save", 0) ; 
  938. X+   XV_SET(ls_frame, XV_SHOW, TRUE, NULL) ;
  939. X  }
  940. X
  941. X------- sunview.c -------
  942. X*** /tmp/da28890    Fri Nov  9 10:38:31 1990
  943. X--- sunview.c    Mon Nov  5 09:08:30 1990
  944. X***************
  945. X*** 7,17 ****
  946. X   *  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
  947. X   *  All rights reserved.
  948. X   *
  949. X!  *  Permission is given to distribute these sources, as long as the
  950. X!  *  introductory messages are not removed, and no monies are exchanged.
  951. X   *
  952. X!  *  You are forbidden from using Reve as is, or in a modified state, in
  953. X!  *  any tournaments, without the permission of the authors.
  954. X   *
  955. X   *  No responsibility is taken for any errors or inaccuracies inherent
  956. X   *  either to the comments or the code of this program, but if reported
  957. X--- 7,22 ----
  958. X   *  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
  959. X   *  All rights reserved.
  960. X   *
  961. X!  *  Permission is granted to copy this source, for redistribution
  962. X!  *  in source form only, provided the news headers in "substantially
  963. X!  *  unaltered format" are retained, the introductory messages are not
  964. X!  *  removed, and no monies are exchanged.
  965. X   *
  966. X!  *  Permission is also granted to copy this source, without the
  967. X!  *  news headers, for the purposes of making an executable copy by
  968. X!  *  means of compilation, provided that such copy will not be used
  969. X!  *  for the purposes of competition in any othello tournaments, without
  970. X!  *  prior permission from the authors.
  971. X   *
  972. X   *  No responsibility is taken for any errors or inaccuracies inherent
  973. X   *  either to the comments or the code of this program, but if reported
  974. X***************
  975. X*** 18,26 ****
  976. X   *  (see README file), then an attempt will be made to fix them.
  977. X   */
  978. X  
  979. X- #include <stdio.h>
  980. X- #include "color.h"
  981. X  #include "reve.h"
  982. X  #include "extern.h"
  983. X  #include "images.h"
  984. X  #include <suntool/sunview.h>
  985. X--- 23,30 ----
  986. X   *  (see README file), then an attempt will be made to fix them.
  987. X   */
  988. X  
  989. X  #include "reve.h"
  990. X+ #include "color.h"
  991. X  #include "extern.h"
  992. X  #include "images.h"
  993. X  #include <suntool/sunview.h>
  994. X***************
  995. X*** 316,322 ****
  996. X    CURSOR_SET(cursor[(int) HOURGLASS], CURSOR_OP, PIX_SRC ^ PIX_DST, 0) ;
  997. X    cursor[(int) NOCURSOR]  = cursor_create(CURSOR_IMAGE, &nocur_pr, 0) ;
  998. X    CURSOR_SET(cursor[(int) NOCURSOR], CURSOR_OP, PIX_SRC ^ PIX_DST, 0) ;
  999. X!   load_colors() ;
  1000. X  
  1001. X    images[(int) BUT_STENCIL] = &button_stencil_pr ;
  1002. X    images[(int) BUT_INVERT]  = &button_invert_pr ;
  1003. X--- 320,326 ----
  1004. X    CURSOR_SET(cursor[(int) HOURGLASS], CURSOR_OP, PIX_SRC ^ PIX_DST, 0) ;
  1005. X    cursor[(int) NOCURSOR]  = cursor_create(CURSOR_IMAGE, &nocur_pr, 0) ;
  1006. X    CURSOR_SET(cursor[(int) NOCURSOR], CURSOR_OP, PIX_SRC ^ PIX_DST, 0) ;
  1007. X!   if (!monochrome) load_colors() ;
  1008. X  
  1009. X    images[(int) BUT_STENCIL] = &button_stencil_pr ;
  1010. X    images[(int) BUT_INVERT]  = &button_invert_pr ;
  1011. X
  1012. X
  1013. END_OF_FILE
  1014. if test 30587 -ne `wc -c <'patches01d'`; then
  1015.     echo shar: \"'patches01d'\" unpacked with wrong size!
  1016. fi
  1017. # end of 'patches01d'
  1018. fi
  1019. echo shar: End of archive 4 \(of 4\).
  1020. cp /dev/null ark4isdone
  1021. MISSING=""
  1022. for I in 1 2 3 4 ; do
  1023.     if test ! -f ark${I}isdone ; then
  1024.     MISSING="${MISSING} ${I}"
  1025.     fi
  1026. done
  1027. if test "${MISSING}" = "" ; then
  1028.     echo You have unpacked all 4 archives.
  1029.     rm -f ark[1-9]isdone
  1030. else
  1031.     echo You still need to unpack the following archives:
  1032.     echo "        " ${MISSING}
  1033. fi
  1034. ##  End of shell archive.
  1035. exit 0
  1036.